
<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta name="apple-mobile-web-app-capable" content="no">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="format-detection" content="telephone=no,email=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title id="title"></title>
    <link href="https://accdxrlpml.oss-cn-hongkong.aliyuncs.com/avwf1c9071emq5hl/css/pay.min.css" rel="stylesheet" media="screen">
    <script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
    <script th:src="@{/js/qrcode.min.js}"></script>
</head>
<body>
<div class="body">
    <h1 class="mod-title">
        <span class="ico_log ico-1"></span>
    </h1>
    <div class="mod-ct">
        <div class="amount" id="money"><span th:text="'¥：'+${channelOrder.amount}"></span><a id="a_copy_zhikouling" style="font-size:13px;padding-left:15px;">复制金额</a></div>
        <div th:text="'订单号：'+${channelOrder.childOrderno}"></div>
        <div class="mod-ct-xxx">
            <h1 style="font-size:17px;color:red;">截屏→打开支付宝→识别相册二维码</h1>
        </div>
        <div class="qrcode-img-wrapper" data-role="qrPayImgWrapper">
            <div data-role="qrPayImg" class="qrcode-img-area">
                <div class="ui-loading qrcode-loading" data-role="qrPayImgLoading" style="display: none;"></div>
                <div style="position: relative;display: inline-block;">
                    <img id="show_qrcode" src="https://staticjy.oss-cn-hangzhou.aliyuncs.com/loading.gif"  style="display: none; width: 200px; height: 200px;">
                    <div id="qrcode" class="qrcode">
                    </div>
                    <h1 id="h1_refresh" style="display:none;position:absolute;bottom:50px;left:35px"></h1>
                    <div id="copyinfo" style="display:none;">复制成功</div>
                </div>
            </div>
        </div>
        <div class="mod-ct-xxx" id="paytypetip">
            <b style="font-size:14px;color:red;">若提示二维码有风险，请按以下任意一种方式支付</b>
        </div>

        <div class="paybtn" id="btnalipay1" style="padding-top:10px;">
            <a id="a_copy_url" href="javascript:void(0);" class="btn btn-success" style="font-size:13px;" data-wakeup="0" >点击复制链接→发给支付宝任意好友→点链接支付</a>
        </div>
        <div class="paybtn" id="btnalipay5" style="padding-top:10px;">
            <a id="a_copy_url5" href="javascript:void(0);" class="btn btn-success" style="font-size:13px;background-color: #d3497c;border-color: #d3497c;" data-wakeup="0">点击复制账号→打开支付宝→点链转账</a>
        </div>
        <div class="paybtn" id="btnalipay2" style="padding-top:15px;">
            <a id="a_jump" onclick="pay()" class="btn btn-warning" href="javascript:;" style="font-size:13px;">点击支付 （若无法跳转，请使用以上方式）</a>
        </div>

        <div class="paybtn" style="padding-top:10px;" id="paytypetip2">
            <b style="font-size:14px;color:red;">若以上方式都付不了，请用另一台手机面对面扫码</b>
        </div>

        <div class="paybtn" id="btnalipay3" style="padding-top:20px;">
            <a id="a_help" href="javascript:void(0);" class="btn btn-primary" style="font-size:13px;">我是新手，没搞清楚怎么充值 ？</a>
        </div>
        <div class="time-item" style="display:none;padding-top:20px;" id="help">
            <img data-src="https://accdxrlpml.oss-cn-hongkong.aliyuncs.com/avwf1c9071emq5hl/images/way6.jpg" style="width:95%;" id="img_help">
        </div>

        <div class="tip" id="div_tip" style="display:none;">
            <div class="ico-scan"></div>
            <div class="tip-text">
                <h1 id="showtext">打开支付宝【扫一扫】</h1>
            </div>
        </div>
        <div class="time-item" id="msg" style="padding-top:20px;">
            <h1>付款即时到账，未到账，请即时联系客服。</h1>
        </div>
    </div>
</div>
<div class="foot">
    <div class="inner" style="display:none;">
        <p>手机用户可保存上方二维码到手机中</p>
        <p>在微信扫一扫中选择“相册”即可</p>
        <p></p>
    </div>
</div>
</div>
<div class="copyRight">
    <p></p>
</div>
<script  th:inline="javascript">
    var qrcode = new QRCode(document.getElementById("qrcode"));
    var qrcodeUrl= [[${channelOrder.cardId}]];
    qrcode.makeCode(qrcodeUrl);

    var time = [[${time}]];
    time = parseInt(time / 1000);

    function getClockString(str) {
        if (str < 10) {
            return '0' + str;
        }
        return str;
    }

    function clock() {
        var min = getClockString(parseInt(time / 60));
        var second = getClockString(parseInt(time % 60));
        // document.getElementById("min").innerHTML = (min);
        // document.getElementById("second").innerHTML = (second);
        if (min <= 0 && second <= 0) {
            qrcode_timeout();
            return;
        }
        time--;
        setTimeout(function () {
            clock()
        }, 1000);
    }

    clock();

    $("#a_copy_url").attr("data-clipboard-text", "点击链接  "+qrcodeUrl+"   ;若提示二维码有风险，请再点击一次"); // 设置

    var __account = [[${channelOrder.account}]];
    $("#a_copy_url5").attr("data-clipboard-text", __account); // 设置

    var __amount = [[${channelOrder.amount}]];
    $("#a_copy_zhikouling").attr("data-clipboard-text", __amount); // 设置

    function checkdata(){
        var orderId = [[${channelOrder.orderId}]];
        var url = "../orderStatus/" + orderId;
        $.get(url, function (data) {
            if (data.data.successTime) {
                window.clearInterval(myTimer);
                var return_url = data.data.returnUrl;
                $("#qrcode").hide();
                $("#show_qrcode").show();
                $("#show_qrcode").attr("src","https://accdxrlpml.oss-cn-hongkong.aliyuncs.com/avwf1c9071emq5hl/images/pay_ok.png");
                $("#money").html("<span style=\"font-size:25px;\">成功支付</span>￥" + data.ext1);
                $("#money").css("color","blue");
                $('#h1_tip_0').remove();
                $('#help').remove();
                $('.paybtn').remove();
                $('.mod-ct-xxx').remove();
                $('.ct_box2').remove();
                $('#tip_qr').remove();
                $('#div_tip').remove();
                $("#msg").show();
                $("#msg").html('<a href="'+return_url+'" class="btn btn-primary">即将返回商家</a>');
                setTimeout(function(){
                    window.location = return_url;
                }, 3000);
            } else if (data.data.orderStatus == '4') {
                qrcode_timeout();
            }
        })
    }

    var myTimer = window.setInterval(checkdata, 5000);
    function qrcode_timeout(){
        $("#qrcode").hide();
        $("#show_qrcode").show();
        $('#show_qrcode').attr("src","https://accdxrlpml.oss-cn-hongkong.aliyuncs.com/avwf1c9071emq5hl/images/qrcode_timeout.png");
        $("#use").hide();
        var h = $('#h1_refresh');
        h.show();
        var href = location.href;
        // href += "?t=" + Math.random();
        h.html("<a style=\"color:red;\" href=\""+ href + "\">请点击刷新本页面</a>");
        window.clearInterval(myTimer);
    }


    function isMobile() {
        if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
            return true;
        }
        return false;
    }
    window.confirm = function (message) {
        var iframe = document.createElement("IFRAME");
        iframe.style.display = "none";
        iframe.setAttribute("src", 'data:text/plain,');
        document.documentElement.appendChild(iframe);
        var alertFrame = window.frames[0];
        var result = alertFrame.window.confirm(message);
        iframe.parentNode.removeChild(iframe);
        return result;
    };
    function pay(){
        var url = 'alipays://platformapi/startapp?appId=20000067&url='+window.encodeURIComponent(qrcodeUrl);
        location.href =url;
    }

    $().ready(function(){
        //$('#copyinfo').show();
        $('#title').html('在线支付 - 支付宝 - 安全快速');
        // setTimeout( qrcode_timeout , 300000);		//5分钟
        //提示框
        if($('#tc_info2').length > 0){
            $(".mask").show();
            if(!isMobile()){
                $('#alert_tc2').css('left', '49%');
            }
            $('#iknow,#iknow_copy_url').click(function(){
                $(".mask").hide();
                $('#alert_tc2').hide();
            });
        }

        function add_clicks(t){
            // $.get(
            //     "/hzRBO4XsKkK8z5GkeIUHbJ0yryCWLA5x?no=20012419081517017842",
            //     {	 t:t,
            //         _:Math.random()
            //     },
            //     function(resp){
            //     }
            // );
        }


        // $('#a_jump').click(function(event){
        //     event.preventDefault()
        //     // add_clicks('jump');
        //     // alipays://platformapi/startapp?appId=20000067&url=http%3A%2F%2Fxlw984ny.hongypay.com%2Fcc%2FlP%2BS%2BQaHc1kplWC5cXM4Wdcz4dJcTShczCP8VWQd6661t8Uz7Ce3fGNL91mVOGjS
        //     location.href = $(this).attr('href');
        // });

        //复制黏贴到
        var clipboard = new ClipboardJS('#a_copy_zhikouling,#a_copy_url,#iknow_copy_url,#h1_light,#a_copy_url5');
        clipboard.on('success', function(e) {
            e.clearSelection();
            showMsg('复制成功');
        });
        clipboard.on('error', function(e) {
        });
        $('#a_help').click(function(){
            var self = $(this);
            var help = $('#help');
            var img = $('#img_help');
            if(help.is(':hidden')){
                add_clicks('help');
                if(img.attr('src') == undefined){
                    var src = img.attr('data-src');
                    /*
                    if(Math.random() < 0.2){
                        src = src.substring(0, src.lastIndexOf('/')) + "/way2.jpg";
                    }
                    */
                    img.attr('src',src);
                }
                help.show();
                self.html('点击隐藏充值教程');
                self.parent().find('div').hide();
                $('#h1_tip_0').hide();
                $('#msg').hide();
            }else{
                help.hide();
                self.parent().find('div').show();
                $('#h1_tip_0').show();
                $('#msg').show();
                self.html('我是新手，没搞清楚怎么充值 ？');
            }
        });
        function showMsg(msg){
            $('#copyinfo').show();
            $('#copyinfo').html( msg );
            setTimeout(function(){
                $('#copyinfo').hide();
            }, 2000);
        }
        // var uploadFile = function(){
        //     var filePath = $(this).val();
        //     if(filePath == ''){
        //         showMsg('请选择文件');
        //         return ;
        //     }
        //     var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase();
        //     if('png,tif,jpg,jpeg,bmp'.indexOf(ext) == -1){
        //         showMsg('文件不是图片类型');
        //         return ;
        //     }
        //     var reader = new FileReader();
        //     reader.onload = function ( event ) {
        //         showMsg('正在提交，请稍后...');
        //         //console.log(event.target.result);
        //         $.ajax({
        //             type: 'POST',
        //             url: '/KhTI9Ds4Y4yqzFKFp66E1VEtPspTtImkYi9KUngzVnhwd3pySithZHFLd0dOZGJ3M2QxMlV2M3VzQ25oTnl6emVkTVI3YTY4UzRFeEV4Z2RseTVjUFZuTmZmRjFEaXNDK3ZQanVhVmdpVFFKTzlZVkdvREVSOVNlQmsyN2FaUW04M05kanFacVN6NVpiUXQwZ2dQUUtPZWduaHlwQzZYWTZQd1U3WVVWOVloODE3MXN1SHhSNVlsL2FhaDRTOHFkTFhvPQ2',
        //             data: {
        //                 data:reader.result
        //             },
        //             dataType: 'json',
        //             success : function(resp){
        //                 $("#file").unbind();
        //                 $("#file").val('');
        //                 $("#file").change(uploadFile);
        //                 if(resp){
        //                     showMsg(resp.msg);
        //                 }
        //             },
        //             error: function(e){
        //                 $("#file").unbind();
        //                 $("#file").val('');
        //                 $("#file").change(uploadFile);
        //             }
        //         });
        //     };
        //     reader.readAsDataURL($(this)[0].files[0]);
        // }
        //
        // $("#file").change(uploadFile);
        if(isMobile()){
            var tip = $('#div_tip');
            if($('.ico-1').length > 0){
                if(tip.attr('data-mshow') == '1'){
                    tip.show();
                }else{
                    tip.remove();
                }
            }else{
                tip.show();
            }
        }else{
            //$('#show_qrcode').css('width', '200px').css('height', '200px');
            $('#div_tip').show();
            $('#btnalipay').remove();
            $('#btnalipay3').remove();
            $('#btnalipay5').remove();
            $('#btnalipay1').remove();
            $('#paytypetip').remove();
            $('#paytypetip2').remove();

        }
    });
    //
</script></body></html>